import os
import time
with open("启动参数.txt","r") as f:
    for line in f.readlines():
        if "月份" in line:
            月份=line.split("=")[1].strip("\n")
    while True:
        try:
            filename=input("请输入你需要打开的质保书名字:")
            os.startfile(os.getcwd()+"\\"+月份+"\\"+filename+".pdf")
            print("已为您打开质保书！")
            for num in range(3,1,-1):
                print(f"{num}秒后继续打开....")
                time.sleep(1)
            print("==============")
        except:
            print("无法打开"+os.getcwd()+"\\"+月份+"\\"+filename+".pdf"+"，可能文件不存在或者名字输入错误！")
            for num in range(3,1,-1):
                print(f"{num}秒后继续打开....")
                time.sleep(1)
            print("==============")
